package com.fy.common.enums;


import com.fy.common.constant.Destination;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.util.StringUtils;

import java.util.Arrays;
import java.util.List;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum ClientType {
    APP,
    PC,
    ;


    public static List<ClientType> getAllClient(){
        return Arrays.asList(ClientType.values());
    }

    public static ClientType getClientType (String destination){
        if(StringUtils.isEmpty(destination)){
            return APP;
        }
        if(destination.startsWith(Destination.PC_USER)
            ||destination.startsWith(Destination.PC_CHANNEL)){
            return PC;
        }
        return APP;
    }
}
